﻿<?php include $this->admin_tpl('meta');?>
<title>订单列表</title>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/jquery/1.8.2/jquery.min.js"></script> 
</head>
<body>
<div class="page-container" style="padding-bottom:0;">
	<form id="search">
		<input type="hidden" value="" name="field">
		<input type="hidden" value="" name="order">
		<input type="hidden" value="0" name="download">
		<div class="c"><input type="text" name="o_id" class="input-text" style="width:100px" placeholder="内部订单号" value="<?php if(isset($_GET['o_id'])) echo $_GET['o_id'];?>"></div>
		<div class="c"><input type="text" name="i_id" class="input-text" style="width:130px" placeholder="款式编码,*号开头模糊匹配" value="<?php if(isset($_GET['i_id'])) echo $_GET['i_id'];?>"></div>
		<div class="c"><input type="text" name="sku_id" class="input-text" style="width:130px" placeholder="商品编码,*号开头模糊匹配" value="<?php if(isset($_GET['sku_id'])) echo $_GET['sku_id'];?>"></div>
		<div class="c"><input type="text" name="name" class="input-text" autocomplete="off" style="width:130px" placeholder="商品名称" value="<?php if(isset($_GET['name'])) echo $_GET['name'];?>"></div>
		<div class="c"><input type="text" name="properties_value" class="input-text" autocomplete="off" style="width:130px" placeholder="颜色尺码" value="<?php if(isset($_GET['properties_value'])) echo $_GET['properties_value'];?>"></div>
	<div class="c">
     <span class="select-box inline">
		<select name="time_type" class="select">
			<option value="0" <?php if($time_type==0) echo 'selected';?>>订单时间</option>
			<option value="1" <?php if($time_type==1) echo 'selected';?>>发货时间</option>
		</select>
	</span>
	</div>
	<div class="c"><input type="text" class="input-text laydate-icon" style="width:130px;height:30px;" autocomplete="off" id="start" name="start" value="<?php echo $start;?>">
     至 <input type="text" class="input-text laydate-icon" style="width:130px;height:30px;" autocomplete="off" id="end" name="end" value="<?php echo $end;?>"></div>
	<?php include $this->admin_tpl('jst_common/select_shop');?>
		<a class="btn btn-success radius" href="javascript:void(0)" id="btn_search"><i class="yzm-iconfont yzm-iconsousuo"></i> 搜索</a>
		<button class="btn btn-primary radius" id="btn_reset" type="reset"><i class="yzm-iconfont yzm-iconshuaxin"></i> 重置</button>
	</form>
	
	<table id="table" class="mt-20" lay-filter="table" style="font-size:12px;"></table>
</div>
<script type="text/html" id="tool_temp">
	<a href="javascript:;" onclick="yzm_open('重新获取订单','<?php echo U('jst_admin/reget_order');?>','600','300')" class="btn btn-primary radius"><i class="yzm-iconfont yzm-iconxuanzhuan-1"></i> 重新获取订单</a>
</script>
<script type="text/html" id="op_temp">
	<a class="layui-btn layui-btn-yzm layui-btn-xs" lay-event="order_item" style="text-decoration:none;" onclick="yzm_open('订单商品','<?php echo U('orders_items');?>?o_id={{= d.o_id}}&shop_id={{= d.shop_id}}',800,600)">订单商品</a>
	<a class="layui-btn layui-btn-success layui-btn-xs" lay-event="order_action" style="text-decoration:none;" onclick="yzm_open('操作明细','<?php echo U('order_action');?>?o_id={{= d.o_id}}&jst_id={{= d.jst_id}}',800,600)">操作明细</a>
</script>
<?php include $this->admin_tpl('jst_common/common_tpl');?>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/layui/layui.js"></script>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script>
var db = 'jst_orders';
layui.use(function(){ //亦可加载特定模块：layui.use(['layer', 'laydate', function(){
	table = layui.table; //表格
	util = layui.util; //工具集
	dropdown = layui.dropdown; //下拉菜单
	form = layui.form;
	//var index = layer.load(1);
	//执行一个 table 实例
	option = {
		elem: '#table',
		id:'table',
		height: 'full-80',
		limit:30,
		limits:[30,60,90],
		url:'<?php echo U('order_list');?>',
		where: $('#search').serializeJson(),
		title: '商品列表',
		autoSort: false,
		page: {theme:'#409eff',groups:3,hash:true}, //开启分页
		toolbar: '#tool_temp', //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
		cols: [[ //表头
			{type: 'checkbox',width:40},
			{field: 'id', title: 'ID', width:80,align:'center'},
			{field: 'o_id', title: '内部单号', width:80,align:'center',sort:true},
			{field: 'l_id', title: '快递单号', width:120,align:'left'},
			{field: 'jst_name', title: '聚水潭', width:80,align:'center'},
			{field: 'labels', title: '订单标签',align:'left',width:200},
			{field: 'shop_name', title: '店铺',align:'center',width:100},
			{field: 'status', title: '状态',align:'center',width:120},
			{field: 'qty_sum', title: '数量',align:'center',width:40,},
			{field: 'question_desc', title: '问题描述',align:'left',width:200},
			{field: 'order_from', title: '订单来源',align:'left',width:100},
			{field: 'remark', title: '备注',align:'left',width:200},
			{field: 'send_date', title: '发货时间',align:'center',width:110,templet: function(row) {if(row.send_date){return util.toDateString(row.send_date*1000, 'yy-MM-dd HH:mm:ss');}else{return '';}}},
			{field: 'order_date', title: '订单时间',align:'center',width:110,templet: function(row) {if(row.order_date){return util.toDateString(row.order_date*1000, 'yy-MM-dd HH:mm:ss');}else{return '';}}},
			{field: 'add_time', title: '抓取时间',align:'center',width:110,templet: function(row) {return util.toDateString(row.add_time*1000, 'yy-MM-dd HH:mm:ss');}},
			{field: 'modified', title: '修改时间',align:'center',width:110,templet: function(row) {return util.toDateString(row.modified*1000, 'yy-MM-dd HH:mm:ss');}},
			{field: 'toolbar',fixed: 'right', title: '操作', width: 200, align:'center', toolbar: '#op_temp'}
		]],
		done:function(res,curr,count){
			$('.layui-table-page').prepend('<div class="layui-inline f-l" style="line-height:26px;">共 <span class="c-primary f-16">'+res.qty_sum+'</span> 件</div>');
			var options = this;
			//layer.close(index);
			public_table(db);
		}
	};
	table.render(option);
	table.hideCol('table', {
	  field: 'id', // 对应表头的 field 属性值
	  hide: true // `true` or `false`
	});
	init_table(db);	
})
var start = {elem:'#start',format:'YYYY-MM-DD',min:'1999-01-01',max:'2099-01-01',istoday:false,choose:function(datas){end.min = datas;end.start = datas}
};
var end =   {elem:'#end',  format:'YYYY-MM-DD',min:'1999-01-01',max:'2099-01-01',istoday:false,choose:function(datas){start.max = datas;}};
laydate(start);
laydate(end);
</script>
</body>
</html>